/*
 * box_viewer.cpp
 *
 *  Created on: Oct 15, 2013
 *      Author: filipe
 */
#include<cstdio>
#include<vector>
#include<string>
#include<opencv/cv.h>
#include<opencv/highgui.h>
#include "BoxSelector.h"

using namespace std;

void
check_args(int argc, char **argv)
{
	if (argc < 2)
	{
		printf("\n");
		printf("Use %s <arquivo_box>\n", argv[0]);
		printf("\n");

		exit(-1);
	}
}


int
main(int argc, char **argv)
{
	char image_filename[1024];
	int x0, y0, x1, y1;
	double disp;

	check_args(argc, argv);

	FILE *f = fopen(argv[1], "r");

	while(!feof(f))
	{
		fscanf(f, "%s\t%d\t%d\t%d\t%d\t%lf\n", image_filename, &x0, &y0, &x1, &y1, &disp);
		string filename(image_filename);

		BoxSelector box = BoxSelector(filename);
		box.SetBox(cv::Rect(x0, y0, x1 - x0, y1 - y0));
		box.Loop();
	}

	fclose(f);
	return 0;
}



